/*
 * Circuit-board look for guest pages (login / register).
 * Colours come from the selected theme via --fac-guest-1/2/3 + --fac-guest-glow (includes/guest_theme_head.php).
 *  - .fac-circuit-bg        full-page background (markup: includes/guest_circuit_bg.php)
 *  - .fac-circuit-panel     faint white traces inside a coloured panel
 *  - .fac-circuit-surface   faint theme-tinted traces inside a white/light card
 */
:root {
    --fac-circuit-tile: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%23000' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M0 30H40L60 50H110L130 30H180M0 150H30L50 130V100L70 80H95M180 150H150L130 170V180M30 0V12L45 27M150 0V20L165 35V70L180 85M110 50V75L125 90H150L165 105V140M95 80V120L115 140H130M0 95H15L25 105V180M60 180V160L75 145'/%3E%3Crect x='72' y='95' width='30' height='22' rx='2'/%3E%3Cpath d='M78 95V90M86 95V90M94 95V90M78 117V122M86 117V122M94 117V122'/%3E%3Cg fill='%23000' stroke='none'%3E%3Ccircle cx='45' cy='27' r='2.6'/%3E%3Ccircle cx='95' cy='80' r='2.6'/%3E%3Ccircle cx='130' cy='140' r='2.6'/%3E%3Ccircle cx='165' cy='140' r='2.6'/%3E%3Ccircle cx='75' cy='145' r='2.6'/%3E%3C/g%3E%3Ccircle cx='45' cy='27' r='5'/%3E%3Ccircle cx='130' cy='140' r='5'/%3E%3Ccircle cx='75' cy='145' r='5'/%3E%3C/svg%3E");
}

/* ── Full-page background ───────────────────────────────── */
.fac-circuit-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.11);
    background:
        radial-gradient(900px 600px at 50% 45%, rgba(255, 255, 255, 0.06), transparent 70%),
        radial-gradient(700px 500px at 0% 100%, color-mix(in srgb, var(--fac-guest-3, #60a5fa) 30%, transparent), transparent 70%),
        radial-gradient(700px 500px at 100% 0%, color-mix(in srgb, var(--fac-guest-1, #1e3a8a) 35%, transparent), transparent 70%);
}

.fac-circuit-bg__svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fac-circuit-bg__traces {
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 1.6;
}

.fac-circuit-bg__nodes {
    fill: color-mix(in srgb, var(--fac-guest-glow, #e0f2fe) 70%, transparent);
    filter: drop-shadow(0 0 4px var(--fac-guest-glow, #7dd3fc));
    animation: facCircuitBlink 4s ease-in-out infinite;
}

.fac-circuit-bg__chips {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1.4;
}

.fac-circuit-bg__chips rect {
    fill: rgba(255, 255, 255, 0.035);
}

.fac-circuit-bg__pulse-a { stop-color: var(--fac-guest-3, #7dd3fc); }
.fac-circuit-bg__pulse-b { stop-color: #ffffff; }

.fac-circuit-bg__pulses use {
    stroke-dasharray: 70 1400;
    stroke-dashoffset: 1470;
    filter: drop-shadow(0 0 5px var(--fac-guest-glow, #7dd3fc));
    animation: facCircuitPulse var(--d, 7s) linear infinite;
    animation-delay: var(--o, 0s);
}

@keyframes facCircuitPulse {
    from { stroke-dashoffset: 1470; }
    to   { stroke-dashoffset: 0; }
}

@keyframes facCircuitBlink {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}

.theme-dark .fac-circuit-bg {
    color: rgba(255, 255, 255, 0.08);
}

/* ── Same pattern inside the forms ──────────────────────── */
.fac-circuit-panel,
.fac-circuit-surface {
    position: relative;
    isolation: isolate;
}

.fac-circuit-panel::before,
.fac-circuit-surface::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    border-radius: inherit;
    -webkit-mask: var(--fac-circuit-tile) 0 0 / 180px 180px repeat;
    mask: var(--fac-circuit-tile) 0 0 / 180px 180px repeat;
}

/* coloured side panels: white traces, stronger toward the bottom */
.fac-circuit-panel::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.16) 100%);
}

/* light cards: theme-tinted traces, only along the top edge so fields stay clean */
.fac-circuit-surface::before {
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--fac-guest-2, #2563eb) 16%, transparent) 0%,
        color-mix(in srgb, var(--fac-guest-2, #2563eb) 5%, transparent) 150px,
        transparent 260px);
}

/* theme gradient strip on the top edge of light cards */
.fac-circuit-surface::after {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--fac-guest-1), var(--fac-guest-2), var(--fac-guest-3)) top / 100% 5px no-repeat;
}

.theme-dark .fac-circuit-surface::before {
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--fac-guest-3, #60a5fa) 14%, transparent) 0%,
        color-mix(in srgb, var(--fac-guest-3, #60a5fa) 4%, transparent) 150px,
        transparent 260px);
}

@media (max-width: 640px) {
    .fac-circuit-bg__chips { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .fac-circuit-bg__pulses { display: none; }
    .fac-circuit-bg__nodes { animation: none; }
}
